
#if UNITY_EDITOR
using UnityEditor.Rendering;
using UnityEditorInternal;
using UnityEditor;
using UnityEditor.U2D;
/// <summary>
/// AssetImporter扩展
/// </summary>
public static partial class ESF_AssetImporterExtend
{
	/// <summary>
    /// 获得AssetImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AssetImporter</returns>
    public static T ToAssetImporter<T>(this string _assetPath)
        where T : AssetImporter
    {
        AssetImporter imp = AssetImporter.GetAtPath(_assetPath.Trim());
        return imp as T;
    }
#region ToAssetImporter
    /// <summary>
    /// 获得IESImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>IESImporter</returns>
    public static IESImporter ToIESImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<IESImporter>();
    }
    /// <summary>
    /// 获得AssemblyDefinitionImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AssemblyDefinitionImporter</returns>
    public static AssemblyDefinitionImporter ToAssemblyDefinitionImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<AssemblyDefinitionImporter>();
    }
    /// <summary>
    /// 获得AssemblyDefinitionReferenceImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AssemblyDefinitionReferenceImporter</returns>
    public static AssemblyDefinitionReferenceImporter ToAssemblyDefinitionReferenceImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<AssemblyDefinitionReferenceImporter>();
    }
    /// <summary>
    /// 获得PackageManifestImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>PackageManifestImporter</returns>
    public static PackageManifestImporter ToPackageManifestImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<PackageManifestImporter>();
    }
    /// <summary>
    /// 获得AssetImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AssetImporter</returns>
    public static AssetImporter ToAssetImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<AssetImporter>();
    }
    /// <summary>
    /// 获得ComputeShaderImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>ComputeShaderImporter</returns>
    public static ComputeShaderImporter ToComputeShaderImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<ComputeShaderImporter>();
    }
    /// <summary>
    /// 获得IHVImageFormatImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>IHVImageFormatImporter</returns>
    public static IHVImageFormatImporter ToIHVImageFormatImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<IHVImageFormatImporter>();
    }
    /// <summary>
    /// 获得ShaderImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>ShaderImporter</returns>
    public static ShaderImporter ToShaderImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<ShaderImporter>();
    }
    /// <summary>
    /// 获得SpeedTreeImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>SpeedTreeImporter</returns>
    public static SpeedTreeImporter ToSpeedTreeImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<SpeedTreeImporter>();
    }
    /// <summary>
    /// 获得TextureImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>TextureImporter</returns>
    public static TextureImporter ToTextureImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<TextureImporter>();
    }
    /// <summary>
    /// 获得AndroidAssetPackImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AndroidAssetPackImporter</returns>
    public static AndroidAssetPackImporter ToAndroidAssetPackImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<AndroidAssetPackImporter>();
    }
    /// <summary>
    /// 获得AudioImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AudioImporter</returns>
    public static AudioImporter ToAudioImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<AudioImporter>();
    }
    /// <summary>
    /// 获得ModelImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>ModelImporter</returns>
    public static ModelImporter ToModelImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<ModelImporter>();
    }
    /// <summary>
    /// 获得MonoImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>MonoImporter</returns>
    public static MonoImporter ToMonoImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<MonoImporter>();
    }
    /// <summary>
    /// 获得PluginImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>PluginImporter</returns>
    public static PluginImporter ToPluginImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<PluginImporter>();
    }
    /// <summary>
    /// 获得VideoClipImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>VideoClipImporter</returns>
    public static VideoClipImporter ToVideoClipImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<VideoClipImporter>();
    }
    /// <summary>
    /// 获得SketchUpImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>SketchUpImporter</returns>
    public static SketchUpImporter ToSketchUpImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<SketchUpImporter>();
    }
    /// <summary>
    /// 获得TrueTypeFontImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>TrueTypeFontImporter</returns>
    public static TrueTypeFontImporter ToTrueTypeFontImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<TrueTypeFontImporter>();
    }
    /// <summary>
    /// 获得SpriteAtlasImporter
    /// </summary>
    /// <typeparam name="T">AssetImporter泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>SpriteAtlasImporter</returns>
    public static SpriteAtlasImporter ToSpriteAtlasImporter(this string _assetPath)
    {
        return _assetPath.ToAssetImporter<SpriteAtlasImporter>();
    }
#endregion
#region ToAssetImporter
    /// <summary>
    /// 获得IESImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>IESImporter</returns>
    public static IESImporter ToIESImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<IESImporter>();
    }
    /// <summary>
    /// 获得AssemblyDefinitionImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AssemblyDefinitionImporter</returns>
    public static AssemblyDefinitionImporter ToAssemblyDefinitionImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<AssemblyDefinitionImporter>();
    }
    /// <summary>
    /// 获得AssemblyDefinitionReferenceImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AssemblyDefinitionReferenceImporter</returns>
    public static AssemblyDefinitionReferenceImporter ToAssemblyDefinitionReferenceImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<AssemblyDefinitionReferenceImporter>();
    }
    /// <summary>
    /// 获得PackageManifestImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>PackageManifestImporter</returns>
    public static PackageManifestImporter ToPackageManifestImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<PackageManifestImporter>();
    }
    /// <summary>
    /// 获得AssetImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AssetImporter</returns>
    public static AssetImporter ToAssetImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<AssetImporter>();
    }
    /// <summary>
    /// 获得ComputeShaderImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>ComputeShaderImporter</returns>
    public static ComputeShaderImporter ToComputeShaderImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<ComputeShaderImporter>();
    }
    /// <summary>
    /// 获得IHVImageFormatImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>IHVImageFormatImporter</returns>
    public static IHVImageFormatImporter ToIHVImageFormatImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<IHVImageFormatImporter>();
    }
    /// <summary>
    /// 获得ShaderImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>ShaderImporter</returns>
    public static ShaderImporter ToShaderImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<ShaderImporter>();
    }
    /// <summary>
    /// 获得SpeedTreeImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>SpeedTreeImporter</returns>
    public static SpeedTreeImporter ToSpeedTreeImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<SpeedTreeImporter>();
    }
    /// <summary>
    /// 获得TextureImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>TextureImporter</returns>
    public static TextureImporter ToTextureImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<TextureImporter>();
    }
    /// <summary>
    /// 获得AndroidAssetPackImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AndroidAssetPackImporter</returns>
    public static AndroidAssetPackImporter ToAndroidAssetPackImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<AndroidAssetPackImporter>();
    }
    /// <summary>
    /// 获得AudioImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>AudioImporter</returns>
    public static AudioImporter ToAudioImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<AudioImporter>();
    }
    /// <summary>
    /// 获得ModelImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>ModelImporter</returns>
    public static ModelImporter ToModelImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<ModelImporter>();
    }
    /// <summary>
    /// 获得MonoImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>MonoImporter</returns>
    public static MonoImporter ToMonoImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<MonoImporter>();
    }
    /// <summary>
    /// 获得PluginImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>PluginImporter</returns>
    public static PluginImporter ToPluginImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<PluginImporter>();
    }
    /// <summary>
    /// 获得VideoClipImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>VideoClipImporter</returns>
    public static VideoClipImporter ToVideoClipImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<VideoClipImporter>();
    }
    /// <summary>
    /// 获得SketchUpImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>SketchUpImporter</returns>
    public static SketchUpImporter ToSketchUpImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<SketchUpImporter>();
    }
    /// <summary>
    /// 获得TrueTypeFontImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>TrueTypeFontImporter</returns>
    public static TrueTypeFontImporter ToTrueTypeFontImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<TrueTypeFontImporter>();
    }
    /// <summary>
    /// 获得SpriteAtlasImporter
    /// </summary>
    /// <typeparam name="T">AbsESF_CollectAsset泛型</typeparam>
    /// <param name="_assetPath">资源路径</param>
    /// <returns>SpriteAtlasImporter</returns>
    public static SpriteAtlasImporter ToSpriteAtlasImporter<T>(this T _node)
	where T:AbsESF_EditorCollectAsset
    {
        return _node.path.ToAssetImporter<SpriteAtlasImporter>();
    }
#endregion
}
#endif